/**
 * "Visual Paradigm: DO NOT MODIFY THIS FILE!"
 * 
 * This is an automatic generated file. It will be regenerated every time 
 * you generate persistence class.
 * 
 * Modifying its content may cause the program not work, or your work may lost.
 */

/**
 * Licensee: Faculty of informatics, Burapha University 01
 * License Type: Purchased
 */
package cn.imvc.app.entities;

import java.io.Serializable;
import javax.persistence.*;
@Entity
@org.hibernate.annotations.Proxy(lazy=false)
@Table(name="goods_spec")
public class GoodsSpec implements Serializable {
	public GoodsSpec() {
	}
	
	private int id;
	
	private cn.imvc.app.entities.Goods goods;
	
	private cn.imvc.app.entities.SpecClass specClass;
	
	private String specClassName;
	
	private String specClassCode;
	
	private java.util.Set goodsSpecValue = new java.util.HashSet();
	
	public void setId(int value) {
		this.id = value;
	}
	
	@Column(name="id", nullable=false)	
	@Id	
	@GeneratedValue(generator="CN_IMVC_APP_ENTITIES_GOODSSPEC_ID_GENERATOR")	
	@org.hibernate.annotations.GenericGenerator(name="CN_IMVC_APP_ENTITIES_GOODSSPEC_ID_GENERATOR", strategy="identity")	
	public int getId() {
		return id;
	}
	
	@Transient	
	public int getORMID() {
		return getId();
	}
	
	/**
	 * 规格类别名称
	 */
	public void setSpecClassName(String value) {
		this.specClassName = value;
	}
	
	/**
	 * 规格类别名称
	 */
	@Column(name="specClassName", nullable=true, length=255)	
	public String getSpecClassName() {
		return specClassName;
	}
	
	/**
	 * 规格类别编码
	 */
	public void setSpecClassCode(String value) {
		this.specClassCode = value;
	}
	
	/**
	 * 规格类别编码
	 */
	@Column(name="specClassCode", nullable=true, length=255)	
	public String getSpecClassCode() {
		return specClassCode;
	}
	
	public void setGoods(cn.imvc.app.entities.Goods value) {
		this.goods = value;
	}
	
	@ManyToOne(targetEntity=cn.imvc.app.entities.Goods.class, fetch=FetchType.LAZY)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.LOCK})	
	@JoinColumns({ @JoinColumn(name="goodsId", referencedColumnName="id", nullable=false) })	
	@org.hibernate.annotations.LazyToOne(value=org.hibernate.annotations.LazyToOneOption.NO_PROXY)	
	public cn.imvc.app.entities.Goods getGoods() {
		return goods;
	}
	
	public void setSpecClass(cn.imvc.app.entities.SpecClass value) {
		this.specClass = value;
	}
	
	@ManyToOne(targetEntity=cn.imvc.app.entities.SpecClass.class, fetch=FetchType.LAZY)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.LOCK})	
	@JoinColumns({ @JoinColumn(name="specClassId", referencedColumnName="id", nullable=false) })	
	@org.hibernate.annotations.LazyToOne(value=org.hibernate.annotations.LazyToOneOption.NO_PROXY)	
	public cn.imvc.app.entities.SpecClass getSpecClass() {
		return specClass;
	}
	
	public void setGoodsSpecValue(java.util.Set value) {
		this.goodsSpecValue = value;
	}
	
	@OneToMany(mappedBy="goodsSpec", targetEntity=cn.imvc.app.entities.GoodsSpecValue.class)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.LOCK})	
	@OrderBy(value="sort")	
	@org.hibernate.annotations.LazyCollection(org.hibernate.annotations.LazyCollectionOption.TRUE)	
	public java.util.Set getGoodsSpecValue() {
		return goodsSpecValue;
	}
	
	
	public String toString() {
		return toString(false);
	}
	
	public String toString(boolean idOnly) {
		if (idOnly) {
			return String.valueOf(getId());
		}
		else {
			StringBuffer sb = new StringBuffer();
			sb.append("GoodsSpec[ ");
			sb.append("Id=").append(getId()).append(" ");
			if (getGoods() != null)
				sb.append("Goods.Persist_ID=").append(getGoods().toString(true)).append(" ");
			else
				sb.append("Goods=null ");
			if (getSpecClass() != null)
				sb.append("SpecClass.Persist_ID=").append(getSpecClass().toString(true)).append(" ");
			else
				sb.append("SpecClass=null ");
			sb.append("SpecClassName=").append(getSpecClassName()).append(" ");
			sb.append("SpecClassCode=").append(getSpecClassCode()).append(" ");
			sb.append("GoodsSpecValue.size=").append(getGoodsSpecValue().size()).append(" ");
			sb.append("]");
			return sb.toString();
		}
	}
	
}
